import { reqLiveRoomList } from "../../api/livesquare"


// pages/livesquare/livesquare.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    liverooms:[]
  },

  async onShow(){
    const {data} = await reqLiveRoomList()
    this.setData({
      liverooms:data
    })
  },

  navigateToindexPage:function(){
    wx.switchTab({
      url: '/pages/index/index',
    })
  },

  navigateToLiveroom(e){
    const roomId = e.currentTarget.dataset.roomid;
    const anchorId = e.currentTarget.dataset.anchorid;
    // console.log(e)
    wx.navigateTo({
      url: `/pages/liveroom/liveroom?anchorId=${anchorId}&roomId=${roomId}`,
    })
  }
 
})